package jiekou;

import java.util.Objects;

class One{
    public int a = 9;
}
interface Zero {
    //在接口中的变量默认是public static final修饰的
    public static final int a = 10;
    String b = "jjj";

    //成员变量默认是public abstract修饰的
    void text();

    public abstract void text2();

    //在接口中也可以有非抽象方法,可以有具体的实现，但是要用static或default修饰，都会默认有public修饰
    public static void text3() {
        System.out.println("这是在接口中用static修饰的方法，能有具体的实现方法");
    }

    public default void run_text3() {
        text3();
    }
    default void text4() {
        System.out.println("这是在接口中用default修饰的方法，能有具体的实现方法，且能够直接使用");
    }
}

interface ZZero {
    void halo();
}


class four extends Two implements Zero, ZZero {//多个继承需要重写俩个接口所有的抽象方法
    //接口中没有构造方法
    public void halo() {

    }

    @Override
    public void text() {

    }

    @Override
    public void text2() {

    }
}
class Two implements Zero {//接口的使用用到implements，需要重写其方法
    @Override
    public void text() {
        System.out.println("子类重写父类方法");
    }

    @Override
    public void text2() {
        System.out.println("子类重写父类方法");
    }
}

class five{

}
abstract class Three implements Zero {
}
class dog {
    String name;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        dog dog = (dog) o;
        return Objects.equals(name, dog.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name);
    }

    public dog(String name) {
        this.name = name;

    }
}
//    public boolean equals(dog name) {
//        return this.name == name.name;
//
//    }
//}
public class first {
    public static void main(String[] args) {
        dog one = new dog("hh");
        dog two = new dog("hh");
        System.out.println(one.equals(two));
        System.out.println(one.hashCode());
        System.out.println(two.hashCode());
    }
    public static void maina(String[] args) {
//        Zero hh = new Zero();//接口不能被实例化
        Object five = new five();
        Zero hh = new Two();
        hh.text();
        hh.text2();
        hh.run_text3();
        hh.text4();

    }
}
